    //
//  TopViewController.m
//  NumLot
//
//  Created by luotao on 12-8-12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "TopViewController.h"
#import "TouchImage.h"
#import "Cons.h"
#define WIDTH 320
#define HEIGTH 50

@implementation TopViewController
/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	[super loadView];
	
	self.view.frame=CGRectMake(0, 10, WIDTH, HEIGTH);
	self.view.userInteractionEnabled=YES;
	
	UIImageView *topBgImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"banner.png"]];
	[self.view addSubview:topBgImage];
	
	TouchImage *topHelp = [[TouchImage alloc]initWithImage:[UIImage imageNamed:@"button_help.png"]];
	topHelp.frame=CGRectMake(280, 0, 30, 30);
	[self.view addSubview:topHelp];
	
	
	UILabel *msgLabel = [[UILabel alloc]init];
	msgLabel.backgroundColor=[UIColor clearColor];
	msgLabel.text=@"十一运，时时彩，中奖送10%";
	msgLabel.textColor=[UIColor whiteColor];
	msgLabel.frame=CGRectMake(50, 0, 230, 30);	
	[self.view addSubview: msgLabel];

	backImageView = [[TouchImage alloc] initWithImage:[UIImage imageNamed:@"button_back.png"]];
	backImageView.frame=CGRectMake(10, -3, 40, 50);
	[self.view addSubview:backImageView];
	backImageView.eventCallback=self;
	backImageView.userInteractionEnabled=NO;
	backImageView.alpha=0.0;
	backImageView.touchEnd=@selector(movePre);
}


-(void)doOutScreen:(id<ViewOutScreenStatus>) src{
	if(LOG_DEBUG){
		NSLog(@"receive event : %d",[src getCurrentViewIndex]);
	}	
	if([src getCurrentViewIndex]==2){
		backImageView.userInteractionEnabled=YES;
		backImageView.alpha=1.0;
	}
	else {
		backImageView.userInteractionEnabled=NO;
		backImageView.alpha=0.0;
	}
	contentViewController = src;
}

-(void)movePre{
	[contentViewController moveView:1];
}

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
